<template>
  <ul>
    <li
      v-for="item in goodsList"
      :key="item.id"
      @click="goProductDetail(item.id)"
    >
      <img
        :src="item.list_pic_url"
        style="display:block;"
        width="100%"
        alt=""
      />
      <div class="van-ellipsis">{{ item.name }}</div>
      <div class="price">{{ item.retail_price | filterMoney }}</div>
    </li>
  </ul>
</template>

<script>
export default {
  props: ['goodsList'],
  name: 'product',
  data () {
    return {
      // imgSrc: require('@/assets/logo.png')
    }
  },
  methods: {
    goProductDetail (id) {
      // 这样写会以params的方式传过去
      // this.$router.push('/productdetail/' + id)
      this.$router.push('/productdetail?id=' + id)
    }
  }
}
</script>

<style lang="less" scoped>
ul {
  padding: 0.1rem 2%;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  li {
    width: 49%;
    background: #fff;
    text-align: center;
    line-height: 0.3rem;
    margin-bottom: 0.1rem;
    // .title {
    //   overflow: hidden;
    //   text-overflow: ellipsis;
    //   ellipsis;英文原意 省略号
    //   white-space: nowrap;
    // }
    .price {
      color: darkred;
    }
  }
}
</style>
